package model

import (
	"errors"
	"github.com/dailing/levlog"
	"time"
)

type UiEle struct {
	Id        int64 `json:"id"`
	UserId    int64 `xorm:"Index Unique"`
	Head      string
	CreatedAt time.Time `json:"created_date" xorm:"created"`
}

func (*UiEle) Delete() error {
	panic("implement me")
}

func (s *UiEle) Get() error {
	ok, err := engine.Get(s)
	if !ok {
		return errors.New("no such record")
	}
	return err
}

func (s *UiEle) Update() error {
	levlog.Error("updating user")
	// _, err := engine.Update(s)
	// return err
	return nil
}

func (s *UiEle) Insert() error {
	_, err := engine.Insert(s)
	levlog.E(err)
	return err
}

func (*UiEle) TableName() string {
	return "patient"
}
